// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   SecureStore.java

package org.quickserver.util.xmlreader;

import java.io.Serializable;

// Referenced classes of package org.quickserver.util.xmlreader:
//            KeyStoreInfo, TrustStoreInfo

public class SecureStore
    implements Serializable
{

    public SecureStore()
    {
        type = "JKS";
        algorithm = "SunX509";
        provider = null;
        keyStoreInfo = null;
        trustStoreInfo = null;
        secureStoreManager = "org.quickserver.security.SecureStoreManager";
    }

    public void setType(String type)
    {
        if(type != null && type.trim().length() != 0)
            this.type = type;
    }

    public String getType()
    {
        return type;
    }

    public void setAlgorithm(String algorithm)
    {
        if(algorithm != null && algorithm.trim().length() != 0)
            this.algorithm = algorithm;
    }

    public String getAlgorithm()
    {
        return algorithm;
    }

    public void setProvider(String provider)
    {
        if(provider != null && provider.trim().length() != 0)
            this.provider = provider;
    }

    public String getProvider()
    {
        return provider;
    }

    public void setKeyStoreInfo(KeyStoreInfo keyStoreInfo)
    {
        if(keyStoreInfo != null)
            this.keyStoreInfo = keyStoreInfo;
    }

    public KeyStoreInfo getKeyStoreInfo()
    {
        return keyStoreInfo;
    }

    public void setTrustStoreInfo(TrustStoreInfo trustStoreInfo)
    {
        if(trustStoreInfo != null)
            this.trustStoreInfo = trustStoreInfo;
    }

    public TrustStoreInfo getTrustStoreInfo()
    {
        return trustStoreInfo;
    }

    public void setSecureStoreManager(String className)
    {
        if(className != null && className.trim().length() != 0)
            secureStoreManager = className;
    }

    public String getSecureStoreManager()
    {
        return secureStoreManager;
    }

    public String toXML(String pad)
    {
        if(pad == null)
            pad = "";
        StringBuilder sb = new StringBuilder();
        sb.append(pad).append("<secure-store>\n");
        sb.append(pad).append("\t<type>").append(getType()).append("</type>\n");
        sb.append(pad).append("\t<algorithm>").append(getAlgorithm()).append("</algorithm>\n");
        if(getProvider() != null)
            sb.append(pad).append("\t<provider>").append(getProvider()).append("</provider>\n");
        if(getKeyStoreInfo() != null)
            sb.append(getKeyStoreInfo().toXML((new StringBuilder(String.valueOf(pad))).append("\t").toString()));
        if(getTrustStoreInfo() != null)
            sb.append(getTrustStoreInfo().toXML((new StringBuilder(String.valueOf(pad))).append("\t").toString()));
        sb.append(pad).append("\t<secure-store-manager>").append(getSecureStoreManager()).append("</secure-store-manager>\n");
        sb.append(pad).append("</secure-store>\n");
        return sb.toString();
    }

    private String type;
    private String algorithm;
    private String provider;
    private KeyStoreInfo keyStoreInfo;
    private TrustStoreInfo trustStoreInfo;
    private String secureStoreManager;
}
